import React from 'react';
import PropTypes from 'prop-types'
import { Tag, Card } from 'antd';
import { Link } from 'dva/router';

class QuestionCard extends React.Component {
    render() {
        const { upmath, answermath, watchmath } = this.props
        const matharr = [upmath, answermath, watchmath];
        const mathstring = ['推荐', '回答', '查看'];
        return (
            <Card style={{ marginBottom: '5px',marginTop:'10px',width:'98%',marginLeft:'1px' }}>
                <div className="QuestionContent">
                    <div className="LeftContent">
                        <ul>
                            {matharr.map((math, index) => {
                                var rstring = (<li />);
                                if (math > 0) {
                                    return <li key={mathstring[index]} className="HasNum"><p>{math}</p><p>{mathstring[index]}</p></li>
                                }
                                else {
                                    return <li key={mathstring[index]} ><p>{math}</p><p>{mathstring[index]}</p></li>
                                }

                            })
                            }
                        </ul>
                    </div>
                    <div className="RightContent">
                        <Link to='/question'><p className="QuestionTitle">{this.props.title}</p></Link>
                        <p className="QuestionInfo">{this.props.content}</p>
                        <Tag color="blue">.NET</Tag>   <Tag color="blue">EF</Tag>
                        <div className="AskPeople">
                            吃猴的香蕉
                </div>
                    </div>
                    <div className="Clear"></div>
                </div>
            </Card >
        )
    }
};

QuestionCard.propTypes = {
    title: PropTypes.string,
    content: PropTypes.string,
    answermath: PropTypes.number,
    watchmath: PropTypes.number,
    upmath: PropTypes.number,
    key: PropTypes.string,
    linkurl: PropTypes.string
};

export default QuestionCard;
